import { App } from 'vue';
export const INJECT_KEY = '__axios_vue3_global_config';
import { AxiosInstance } from 'axios';

export declare interface AxiosVue3Config {
  axiosInstance?: AxiosInstance,
  autoRetry?: boolean | {
    enabled: boolean,
    maxCount?: number,
    interval?: number,
  },
  cancelOnUnmounted?: boolean,
}

export const axiosVue3Plugin = {
  install(
    app: App,
    options: AxiosVue3Config = {}
  ) {
    app.provide(INJECT_KEY, options);
  }
};
